using System;
using System.Data;
using System.Collections.Generic;
using System.Collections;
using log4net;
using FSS.BLL.Entities;
namespace FSS.BLL.Services
{
    #region ObjectService

    /// <summary>
    /// ObjectService object for Ibatis mapped table 'Object'.
    /// </summary>
    public class ObjectService : IObjectService
    {
        private static readonly ILog log = LogManager.GetLogger(typeof(ObjectService).Name);
        private static volatile ObjectService _ObjectService = null;
        public static ObjectService GetInstance()
        {
            if (_ObjectService == null)
            {
                lock (typeof(ObjectService))
                {
                    if (_ObjectService == null) // double-check
                        _ObjectService = new ObjectService();
                }
            }
            return _ObjectService;
        }
        public ObjectService()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        /// <summary>
        /// Lay danh sach nha cung cap
        /// </summary>
        /// <returns></returns>
        public IList<ObjectEntity> GetAllProvider()
        {
            try
            {
                return ExecuteQueryForList<ObjectEntity>("ObjectLoadProvider", null);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
        public int ObjectUpdateCheck(ObjectEntity objE)
        {
            try
            {
                ExecuteUpdate("ObjectUpdateCheck", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return 0;
            }
        }
        public IList<ObjectEntity> ObjectLoadCustomer()
        {
            try
            {
                return ExecuteQueryForList<ObjectEntity>("ObjectLoadCustomer", null);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
    }
    #endregion
}
